<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>对象语法</title>
  <style>
    .border {
      width: 200px;
      height: 200px;
      border: 1px solid red;
    }
    .active {
      background-color: aqua;
    }
  </style>
</head>
<body>

<div id="app">
  <button @click="handle">切换样式</button>
  <div :class="{active: isActive}">
    测试样式绑定
  </div>
</div>

<script src="../lib/vue.js"></script>
<script>
  let vm = new Vue({
    el: '#app',
    data: {
      isActive: false,
      hasBorder: false
    },
    methods: {
      handle() {
        this.isActive = !this.isActive;
        this.hasBorder = !this.hasBorder
      }
    }
  })
</script>

</body>
</html>